<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ page isELIgnored="false" %>
<title>"科学"号线上运行管理平台</title>
<meta name="description" content="科学号线上运行管理平台"/>
<%@ include file="/include/taglibs.jsp" %>
<script src="${ctx}/assets/admin/LingUI/js/moment.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="${ctx}/css/base.css"/>
<link rel="stylesheet" href="${ctx}/css/pagination.css"/>
<link rel="stylesheet" href="${ctx}/assets/admin/LingUI/css/ui.jqgrid.css"/>
<script charset="utf-8" src="${ctx}/js/jquery.pagination.js"></script>
<script type="text/javascript" src="${ctx}/assets/admin/LingUI/js/moment.min.js"></script>
<div class="row">
    <div class="col-xs-12">
        <div class="mm_top">
            <div class="mm_top1"><span class="mm_top1span">你好，欢迎使用"科学"号线上运行管理平台</span></div>
          <%--  <div class="mm_top2">
           &lt;%&ndash;     <span class="mm_top2span">您上次的登录时间：2016-01-01 10:10:00</span>&ndash;%&gt;
            </div>--%>
        </div>
        <div class="b_grid_line  col-lg-12"></div>
        <div id="tzggm">
            <div id="linkmm">
                <div class="article  notice">
                    <div class="wrap-l">
                        <div class="title ue-clear" style="height: 33px;">
                            <h2 style="height: 33px;line-height:33px;float:left;margin:0px;padding:0px;padding-left:22px; margin-left: 10px"
                                class="tzgg">公告通知</h2>
                        </div>
                        <div class="home_part" style="height: 400px;margin-bottom:10px;">
                            <ul class="notice-list" id="tzgg"  style="height: 320px;">

                            </ul>
                            <div class="list_page" style="text-align: center;height: 40px;">
                                <div class="view_page" style="text-align: center;">
                                    <div class="pagination" id="page"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div>

    </div>
</div>
<script type="text/javascript">
    var pageSize = 10;     //每页显示多少条记录
    var total;           //总共多少记录
    var scripts = [null, null];
    ace.load_ajax_scripts(scripts, function () {
//        getNotices(0);
    });

    $(function(){
        //searchData();
    });


    function getNotices(pageIndex){
        $('#tzgg').empty();
        var index;
        $.ajax({
            type:'POST',
            url:'${ctx}/${appPath}/notice/list',
            data: {
                page: pageIndex+1,
                rows: pageSize
            },
            dataType:'json',
            success:function(data) {
                var html = "";
                total = data.records;
                $.each(data.rows,function(index, item){
                    html +='<li class="ue-clear"> ' +
                            '<span class="reddot"></span> ' +
                            '<a class="notice-title ellipsis" title="'+item.title+'" ' +
                            'onclick="viewTZ(\''+item.id+'\')">'+item.title+'</a><div class="notice-time"></div>' +
                            '<div class="notice-time">'+lui.timestampFormat(item.created,"YYYY-MM-DD")+'</div>' +
                            '</li>';
                });
                if ($("#page").html().length == '') {
                    $("#page").pagination(total, {
                        'items_per_page': pageSize,
                        a_fn: getNotices      //前一个表示您当前点击的那个分页的页数索引值，后一个参数表示装载容器。
                    });
                }
                $("#tzgg").html(html);
            },
            error:function(data) {
                lui.fail("加载失败");
            },
            complete:function(){
                layer.close(index);
            }
        });
    }

    function  viewTZ(_id) {
        var v=lui.openNoBtn({
            title: '查看',
            content: "${ctx}/${appPath}/notice/view?id=" + _id,
            area: ['600px', '500px'],
            maxmin: true,
            btnAlign:'c',
            yes: function (index, layero) {
                lui.close(mask);
            }
        });
        layer.full(v);

    }

</script>
